// 获取分类
import { useRoute,onBeforeRouteUpdate } from 'vue-router'
import {getTwoList} from '@/api/category.js'
import {ref} from 'vue'
export const getList=()=>{
  
  const route=useRoute()
  const data=ref({})
  const getData=async (id)=>{
    const {result:res}=await getTwoList(id)
    data.value=res
  }
  onBeforeRouteUpdate((to,from)=>{
    getData(to.params.id)
  })
  getData(route.params.id)
  return {
    data
  }
}